Skip to main content

Set Web Attribute

AutomatR.Web.SetWebAttribute

The "Set Web Attribute" activity in AutomatR is designed for UI automation workflows, allowing you to set the value of a specified HTML attribute for a selected web element. This activity is useful for dynamically updating attributes such as class names, data attributes, or any other HTML attribute of interest.

Properties

NameDescription
Input
AttributeEnter the name of the HTML attribute to be updated for the selected web element. This can be any valid HTML attribute such as "class," "id," or custom data attributes. String variables containing the attribute name.
ValueEnter the string value to be set to the specified attribute. This is the value that will be assigned to the HTML attribute for the selected web element. String variables containing the attribute value.
ElementSelect the web element using the provided selector window. This indicates the UI element on the web page. Use either the "Element" or "WebElement" property.
WebElementEnter the UI element variable identified by the "Find Element" or other activities. Use either the "Element" or "WebElement" property.
Optional
TimeoutEnter the time, in seconds (e.g., 5), for the activity to be executed before throwing an exception. This is the maximum time the activity will wait for the UI element to be ready for the attribute update. If not provided, a default timeout will be used.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. String variables containing the desired display name.
Highlight TimeIf the workflow instance is set to highlight elements during execution, specify the time duration (in milliseconds) for which the element should be highlighted after setting the attribute.

How to use:

  1. Drag and drop the "Set Web Attribute" activity onto the workflow.
  2. Configure the properties by selecting the web element or providing the UI element variable, specifying the attribute name, and entering the value to be set.
  3. Optionally, configure the timeout and highlight time.
  4. Execute the workflow to update the HTML attribute for the targeted UI element on the web page.

Example: Consider an example where the "Set Web Attribute" activity is used to update the class attribute of a button on a web page:

Set Web Attribute:
Element: (Use the selector window to choose the button element)
Attribute: "class"
Value: "btn-primary"
Timeout: 5 (seconds)
Highlight Time: 500 (milliseconds)

In this example, the activity sets the "class" attribute of the specified button element to "btn-primary." The timeout is set to 5 seconds, and the element is highlighted for 500 milliseconds after updating the attribute.